import { login,getSetting } from "../../utils/asyncWx";

Page({

    data: {
    },
    async handleGetUserInfo(e) {
        try {
            const res =  await getSetting()
            console.log(res);
        const { encryptedData, rawData, iv, signature } = e.detail;

        const { code } = await login();

            const loginParams = { encryptedData, rawData, iv, signature, code };

            // const res = await request({ url: "/user/wxlogin", data: loginParams, method: "post" });
         
            let token = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjIzLCJpYXQiOjE1NjQ3MzAwNzksImV4cCI6MTAwMTU2NDczMDA3OH0.YPt-XeLnjV-_1ITaXGY2FhxmCe4NvXuRnRB8OMCfnPo";
            console.log(token);
            wx.setStorageSync('token', token);
            wx.navigateBack({
                delta: 1, // 回退前 delta(默认为1) 页面

            })
        } catch (error) {
            console.log(error);
        }
    },

})